package com.sunbim.rsrv.common.validation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class StrNoEmptyValidator implements ConstraintValidator<StrNoEmpty, String> {
    @Override
    public void initialize(StrNoEmpty constraintAnnotation) {
        ConstraintValidator.super.initialize(constraintAnnotation);
    }

    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        if (s == null) return true;
        return !s.trim().isEmpty();
    }
}
